<template>
<slot :controller="controller" :store="store" :model="model" >
        <div :class="classNames" :id="controlID">
            <slot name="container1Container" :controller="controller" :store="store" :model="model" >
            <AppStandardContainer 
                name="container1"
                v-show="store.layoutModelDetails?.container1?.visible"
                :isMultiContainer="false"
                :layoutModelDetails="store.layoutModelDetails">
                <template #static_label1>
                    <slot name="static_label1" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                    <AppPresetText 
                        name="static_label1"
                        @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                        :layoutModelDetails="store.layoutModelDetails" />
                    </slot>
                </template>
                <template #container2>
                    <slot name="container2Container" :controller="controller" :store="store" :model="model" >
                    <AppStandardContainer 
                        name="container2"
                        v-show="store.layoutModelDetails?.container2?.visible"
                        :isMultiContainer="false"
                        :layoutModelDetails="store.layoutModelDetails">
                        <template #button_calluilogic1>
                            <slot name="button_calluilogic1" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                            <AppPresetButton
                                name="button_calluilogic1"
                                :loading="store.loadingHelper.isLoading"
                                :layoutModelDetails="store.layoutModelDetails"
                                :value="store.layoutData.button_calluilogic1"
                                @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                                />
                            </slot>
                        </template>
                        <template #field_textbox>
                            <slot name="field_textbox" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                            <AppPanelField
                                name="field_textbox"
                                :value="store.layoutData.field_textbox"
                                :layoutModelDetails="store.layoutModelDetails">
                                <slot name="field_textboxEditor" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                                <AppInput
                                    v-bind="{ editorType: 'TEXTBOX', }"
                                    type="text"
                                    style=""
                                    name="field_textbox"
                                    :isDebounce="true"
                                    :disabled="store.layoutModelDetails.field_textbox?.disabled ? true : false"
                                    :value="store.layoutData.field_textbox"
                                    @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                                />
                                </slot>
                            </AppPanelField>
                            </slot>
                        </template>
                    </AppStandardContainer>
                    </slot>
                </template>
                <template #static_label2>
                    <slot name="static_label2" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                    <AppPresetText 
                        name="static_label2"
                        @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                        :layoutModelDetails="store.layoutModelDetails" />
                    </slot>
                </template>
                <template #field_textbox1>
                    <slot name="field_textbox1" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                    <AppPanelField
                        name="field_textbox1"
                        :value="store.layoutData.field_textbox1"
                        :layoutModelDetails="store.layoutModelDetails">
                        <slot name="field_textbox1Editor" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                        <AppInput
                            v-bind="{ editorType: 'TEXTBOX', }"
                            type="text"
                            style=""
                            name="field_textbox1"
                            :isDebounce="true"
                            :disabled="store.layoutModelDetails.field_textbox1?.disabled ? true : false"
                            :value="store.layoutData.field_textbox1"
                            @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                        />
                        </slot>
                    </AppPanelField>
                    </slot>
                </template>
                <template #field_textbox2>
                    <slot name="field_textbox2" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                    <AppPanelField
                        name="field_textbox2"
                        :value="store.layoutData.field_textbox2"
                        :layoutModelDetails="store.layoutModelDetails">
                        <slot name="field_textbox2Editor" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                        <AppInput
                            v-bind="{ editorType: 'TEXTBOX', }"
                            type="text"
                            style=""
                            name="field_textbox2"
                            :isDebounce="true"
                            :disabled="store.layoutModelDetails.field_textbox2?.disabled ? true : false"
                            :value="store.layoutData.field_textbox2"
                            @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                        />
                        </slot>
                    </AppPanelField>
                    </slot>
                </template>
                <template #field_textbox3>
                    <slot name="field_textbox3" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                    <AppPanelField
                        name="field_textbox3"
                        :value="store.layoutData.field_textbox3"
                        :layoutModelDetails="store.layoutModelDetails">
                        <slot name="field_textbox3Editor" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                        <AppInput
                            v-bind="{ editorType: 'TEXTBOX', }"
                            type="text"
                            style=""
                            name="field_textbox3"
                            :isDebounce="true"
                            :disabled="store.layoutModelDetails.field_textbox3?.disabled ? true : false"
                            :value="store.layoutData.field_textbox3"
                            @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                        />
                        </slot>
                    </AppPanelField>
                    </slot>
                </template>
            </AppStandardContainer>
            </slot>
        </div>
</slot>
</template>
<script setup lang="ts">
// 基于template/src/widgets/{{appEntities}}/{{ctrls@PANEL}}-panel/{{spinalCase ctrl.codeName}}-panel-base.vue.hbs生成

import { AppCtrlPos, AppScrollContainer, AppSimpleFlexContainer, AppStandardContainer, AppTabPanel, AppTabPage } from '@components/layout-element/structure';
import { IContext, IParam, createUUID, ILoadingHelper, ICtrlDataAction,IViewCtx, IEvent } from "@/core";
import { useProps, useBasic, useController } from './test-list-Panel-hook';
import { PanelActionType, IPanelAbility, IPanelStore, IViewLogicInput } from "@/core/interface";

// 输入参数
const props = defineProps(useProps());

// 基础数据
const { controlID, getClassNames, model ,useNavParamsBind, useEventBind, handleComponentAction } = useBasic(props);

const emit = defineEmits<{
    (event: 'ctrl-action', name: string, action: PanelActionType, data: IParam[]): void;
    (event: 'ctrl-init', name: string, data: IPanelAbility): void;
    (event: 'ctrl-destroy', name: string, data: IParam): void;
}>();

const evt = useEventBind(emit);
//  部件样式名
const classNames = computed(() => {
  return getClassNames(props);
});

//  面板部件控制器
const controller = useController(props, evt, { controlID });

useNavParamsBind(controller, props);

const store: IPanelStore = controller.getStore();

onMounted(() => {
    controller.ctrlMounted();
});
onUnmounted(() => {
    controller.ctrlDestroy();
})
</script>